<?xml version="1.0" encoding="windows-1251"?>

<region name='ClassOutline' parent='def:Outlined'/>
<region name='FunctionOutline' parent='def:Outlined'/>

<region name="HereDoc" parent="perl:HereDoc"/>
<region name="HereDocName" parent="perl:HereDocName"/>
<region name="HereDocLt" parent="perl:HereDocLt"/>
<region name="NowDoc" parent="perl:HereDoc"/>
<region name="NowDocName" parent="perl:HereDocName"/>
<region name="NowDocLt" parent="perl:HereDocLt"/>
<region name="SystemExec" parent="perl:SystemExec"/>
<region name="VarString" parent="def:Var"/>
<region name="php.type" parent="def:TypeKeyword"/>
<region name="php.label" parent="def:Label"/>
<region name="php.keyword" parent="def:Keyword"/>

<region name="DocBlockEntity" parent="def:Identifier" />
<region name="DocBlockVar" parent="def:Var" />
<region name="DocBlockParam" parent="def:ParameterUnknown" />

<entity name="DocBlockEntity" value="(?{DocBlockEntity}@[\w\\-]+\b)"/>
<entity name="PatternModifiers" value="[eimsuxADJSUX]" />

<region name="Namespace" parent="def:Prefix" />
<region name="NamespaceDelimoter" parent="def:SymbolStrong" />

<!-- symbolic link -->
<scheme name="VarLink">
    <regexp match="/\$\$\w+/" region="VarString"/>
    <block start="/\$\{/" end="/\}/"
        scheme="Script" region="VarString"
        region00="PairStart" region10="PairEnd"
    />
</scheme>


<!-- pure strings -->      
<scheme name="StringBaseCorePrintf">
    <regexp match="/\% (\d+\$)? (\\\'.)? ([+-]?(\d+)?(\.\d+)?)? [bcdeEuufFgGosxX]/x" region0="def:VarStrong" />
    <regexp match='/\\$/' region0="StringContent"/>
</scheme>
<scheme name="StringCorePrintf">
    <regexp match="/\% (\d+\\\$)? (\'.)? ([+-]?(\d+)?(\.\d+)?)? [bcdeEuufFgGosxX]/x" region0="def:VarStrong" />
    <regexp match='/\\[^xX0-7]/' region0="StringContent"/>
    <regexp match='/\\$/' region0="StringContent"/>
    <regexp match='/\\(x|X)[\da-fA-F]{1,8}/' region0="StringContent"/>
    <regexp match='/\\[0-7]{1,12}/' region0="StringContent"/>
</scheme>
<scheme name="StringBaseCore">
    <regexp 
        match="/(\\\\)+\\\M[^&apos;&quot;\\]/" region0="StringContent"
    /> <!-- hack for \\\' (ЗУБОЧИСТКИ :-E~ ) -->
    
    <inherit scheme="StringBaseCorePrintf"/>
    <regexp match="/\\['\\]/" region0="StringContent"/>
</scheme>

<scheme name="StringCore">
    <inherit scheme="StringBaseCore">
        <virtual scheme="StringBaseCorePrintf" subst-scheme="StringCorePrintf" />
    </inherit>
    <!-- regexp match='/\\\\$/' region0="dError"/ -->
    
    <!-- Vars -->
    <inherit scheme="VarLink"/>
    <block start="/\{\M\$\w+/" end="/\}/"
        scheme="Script" region="VarString"
        region00="def:PairStart" region10="def:PairEnd"
    />
    <regexp match='/\$\w+/' region0="VarString"/>   
    <!-- regexp match='/[^\\\"]$/' region0="dError"/ -->
</scheme>

<!-- RPSE Regexp -->

<scheme name="RegExp.Modif">
    <keywords region="regexp:SpecArea">
        <symb name="i"/>
        <symb name="m"/>
        <symb name="s"/>
        <symb name="x"/>
        <symb name="J"/>
        <symb name="U"/>
        <symb name="X"/>
        <symb name="-" region="def:Symbol"/>
    </keywords>
    <inherit scheme="regexp:pcre.modif"/> 
</scheme>

<scheme name="RegExp.BaseCore">
    <inherit scheme="regexp:pcre.regexp">
        <virtual scheme="regexp:string" subst-scheme="StringBaseCore"/>
        <virtual scheme="regexp:pcre.modif" subst-scheme="RegExp.Modif"/>
        <virtual scheme="regexp:pcre.regexp" subst-scheme="RegExp.BaseCore"/>
    </inherit>
</scheme>

<scheme name="RegExp.Core">
    <inherit scheme="regexp:pcre.regexp">
        <virtual scheme="regexp:string" subst-scheme="StringCore"/>
        <virtual scheme="regexp:pcre.modif" subst-scheme="RegExp.Modif"/>
        <virtual scheme="regexp:pcre.regexp" subst-scheme="RegExp.Core"/>
    </inherit>
</scheme>

<scheme name="RegExp.StringBase">
    <annotation> 
        <documentation>
            php regexp for '' strings
        </documentation>
        <appinfo> <todo> <![CDATA[
                Multistring regexps not supported now.
                For add this functionality, change ) to |$) before end of
                last string of this regexp.
                
                Note! This can make problems with the text similar to this:
                $str='| a long
                string
                ';
                if first symbol of string - ^\w\s. 
                I recommend to use HERE DOC in this case.
        ]]> </todo> </appinfo> 
    </annotation> 
    
    
    <inherit scheme="StringBaseCore"/>
    <block scheme="RegExp.BaseCore">
        <start region2="def:PairStart" region3="StringEdge"><![CDATA[
            /([^\\]')?#2
             (([\/\|\@\#\%\$\^&\*\?\!\~]))\M
             (([^'])|(\\'))*(\2[%PatternModifiers;]*')
            /xs
        ]]></start>
        <end region1="def:PairEnd" region2="StringEdge" region3="regexp:SpecArea">
        <![CDATA[
            /((\y2([%PatternModifiers;]*)))\M'/
        ]]></end>
    </block>
</scheme>


<scheme name="RegExp.String">
    <annotation> 
        <documentation>
            php regexp for custom "" strings
        </documentation>
        <appinfo> <todo> <![CDATA[
                Не поддерживаются многострочные регекспы.
                Для их включения заменить ) на |$) в конце последней сторки регекспа
                
                Внимание! Это может создавать проблемы с записями типа:
                $str="| длинная
                стока
                ";
                если первый символ строки - ^\w\s. 
                Я рекомендую в таких случаях использовать here doc.
        ]]> </todo> </appinfo> 
    </annotation> 
    
    
    <inherit scheme="StringCore"/>
    <block scheme="RegExp.Core">
        <start region2="def:PairStart" region3="StringEdge"><![CDATA[
            /([^\\]")?#2
             (([\/\|\@\#\%\$\^&\*\?\!\~]))\M
             (([^"])|(\\"))*(\2[%PatternModifiers;]*")
            /xs
        ]]></start>
        <end region1="def:PairEnd" region2="StringEdge" region3="regexp:SpecArea">
        <![CDATA[
            /((\y2([%PatternModifiers;]*)))\M"/
        ]]></end>
    </block>
</scheme>


<!-- Posix functions are deprecated. Didn't work for a long time anyway -->
<!-- POSIX RegExp - ->

<scheme name="posix.BaseCore">
    <inherit scheme="regexp:posix.regexp">
        <virtual scheme="regexp:string" subst-scheme="StringBaseCore"/>
        <virtual scheme="regexp:posix.regexp" subst-scheme="posix.BaseCore"/>
    </inherit> 
</scheme>

<scheme name="posix.Core">
    <inherit scheme="regexp:posix.regexp">
        <virtual scheme="regexp:string" subst-scheme="StringCore"/>
        <virtual scheme="regexp:posix.regexp" subst-scheme="posix.Core"/>
    </inherit> 
</scheme>

<scheme name="posix.Support-content">
    <block start='/~[^\,]*?((&#34;))/' end='/(&#34;)/'
        scheme="posix.Core" region="String" 
        region01="PairStart" region10="PairEnd"     
    />
    <block start="/~[^\,]*?((\'))/" end="/(\')/"
        scheme="posix.BaseCore" region="String" 
        region01="PairStart" region10="PairEnd"     
    />
    <inherit scheme="Script"/>
</scheme>

<scheme name="posix.Support" if="posix-re">
    
    <block start="/\b(ereg\w*|spliti?|sql_regcase)((\())/i" 
        end="/(\))/" scheme="posix.Support-content" 
        region01="KeywordStrong" region02="PairStart" region03="Symbol"
        region10="PairEnd" region11="Symbol"
    />
</scheme-->

<scheme name="php.numbers">
    <inherit scheme="CHexNumber"/>
    <inherit scheme="FloatNumber"/>
    <inherit scheme="DecNumber"/>
    <inherit scheme="BinNumber"/>
</scheme>
<scheme name="php.booleans">
    <keywords region="def:BooleanConstant" ignorecase="yes">
        <word name="true"/>
        <word name="false"/>
    </keywords>
</scheme>

<scheme name="DocBlockVar">
    <regexp match="/\$[\w-]+/" region="DocBlockVar" />
</scheme>
<scheme name="DocBlockType">
    <inherit scheme="DocBlockVar"/>
    <keywords region="Symbol">
        <symb name="|"/>
        <symb name="]"/>
        <symb name="["/>
    </keywords>
    <regexp match="/[^\s\|\[\]]*/" region="php.type"/>
</scheme>
<scheme name="DocBlockEntity">
    <block start="/(@(param|property|return|throws|var)\b)\s*/" end="/\s|$|(\*\/?=)/" scheme="DocBlockType"
        region01="DocBlockEntity"
    />
    <block start="/%DocBlockEntity; \s* ((\())/x" end="/(\))/" scheme="DocBlockEntityParams"
        region01="Symbol"     region10="Symbol"
        region02="PairStart"  region11="PairEnd"
    />
    <regexp match="/%DocBlockEntity;/" />
    <inherit scheme="DocBlockVar"/>
    <inherit scheme="Comment"/>
</scheme>
<scheme name="DocBlockEntityParams">
    <inherit scheme="DocBlockEntity" />
    <regexp match="/(([&quot;&apos;])).*?((\1))/" region="String"
        region1="PairStart"  region3="PairEnd"
        region2="StringEdge" region4="StringEdge"
     />
    <block start="/(\{)/" end="/(\})/" scheme="DocBlockEntityParams"
        region00="SymbolStrong" region10="SymbolStrong"
        region01="PairStart"    region11="PairEnd"
    />
    <regexp match="/\w+\s*=?=/" region="def:Parameter"/>
    <inherit scheme="php.numbers"/>
    <inherit scheme="php.booleans"/>
    <keywords region="Symbol">
        <symb name="="/>
        <symb name=","/>
    </keywords>
    <regexp match="/[\w-]+(\s*=)?=/" region="DocBlockParam"/>

    <regexp match="/&quot;/" region="Error" priority="low"/>
</scheme>

<scheme name="DocBlock" if="docblock">
	<inherit scheme="DocBlockEntity"/>
</scheme>

<scheme name="Namespaces">
	<regexp match="/([\w]+)\\?=/" region1="Namespace" />
    <keywords region="NamespaceDelimoter">
    	<symb name="\"/>
    </keywords>
</scheme>
<scheme name="Script">
    <!-- Numbers -->
    <inherit scheme="php.numbers"/>
    <inherit scheme="php.booleans"/>
    <inherit scheme="Namespaces"/>

    <!-- support regexp -->
    <block start="/&quot;/" end="/&quot;/" 
        scheme="RegExp.String" region="String"
        region00="PairStart" region10="PairEnd"
    />
    <block start="/&apos;/" end="/&apos;/" 
        scheme="RegExp.StringBase" region="String"
        region00="PairStart" region10="PairEnd"
    />
    
    
    <!-- Linear Comments-->
    <block start="/\/\/|\#/" end="/$/" scheme="Comment" region="Comment" priority="low"/>
    <block start="/(\/\*)\*?=/" end="/(\*\/)/" scheme="DocBlock"
        region="CommentDocContent" inner-region="yes"
        region00="PairStart"       region10="PairEnd"
        region01="CommentDocEdge"  region11="CommentDocEdge"
    />
    <block start="/\/\*/" end="/\*\//" scheme="Comment"
        region="Comment" region00="PairStart" region10="PairEnd"
    />

    <!-- heredoc -->    
    <block start="/(&lt;&lt;&lt;)\s*?&quot;?([a-zA-Z_][\w_]*)&quot;?(\s.*)?$/" end="/^(\y2);?$/" 
        scheme="StringCore" region="HereDoc" 
        region00="PairStart" region10="PairEnd" region03="def:Error"
        region01="HereDocLt" region02="HereDocName" region11="HereDocName"
    />
    
    <!-- nowdoc -->
    <block start="/(&lt;&lt;&lt;)\s*?'([a-zA-Z_][\w_]*)'(\s.*)?$/" end="/^(\y2);?$/" 
        scheme="StringBaseCore" region="String" 
        region00="PairStart" region10="PairEnd" region03="def:Error"
        region01="NowDocLt" region02="NowDocName" region11="NowDocName"
    />

    <!--  System command -->
    <block start="/`/" end="/`/" scheme="StringCore" 
        region="SystemExec" region00="String" region10="String"
    />
<!-- Posix functions are deprecated. Didn't work for a long time anyway -->
    <!--inherit scheme="posix.Support"/-->
    
    <inherit scheme="VarLink"/>
    <!-- variable highlighting -->
    <regexp match="/\B\$(this)\b/" region0="Var" region1="Keyword"/>
    <regexp match="/(\B\$[\w][\w_]*?)\b/" region="Var"/>
    <!-- variable for objects -->         
    <regexp match='/(\-&gt;)(\s)*\w+((\w)*(\s)*\()?!/' region="Var" region1="Symbol" />
    
    <!-- speedup for big spaced files -->
    <regexp match="/^\s+\M\s/"/>
    <!-- outlines -->
    <regexp match="/\M (^|\s)(class|interface) \s+ (?{ClassOutline}[\w_]+ [\w_:\$]*? )/ix"/>
    <regexp match="/\M (^|\s)(function) [\s&amp;]+ (?{FunctionOutline}[\:\w_*&amp;~]+)/ix"/>    
    
    <regexp match="/((\())\s*(integer|int|boolean|bool|float|double|string|array|object|resource)\s*((\)))/"
        region="php.type"
        region1="def:PairStart" region2="Symbol" region4="Symbol" region5="def:PairEnd"
    />

    <inherit scheme="PairedBrackets">
        <virtual scheme="PairedBrackets" subst-scheme="Script"/>
    </inherit>
    
    <!--block start="/((\)?#1)\:)/" end="/(else|endforeach|endfor|endif|endwhile)/" scheme="Script"
        region00="SymbolStrong" region01="PairStart"
        region10="php.keyword" region11="PairEnd"
    />
    <block start="/(else)?#4\s*((\:))/" end="/(endif)/" scheme="Script"
        region02="SymbolStrong" region03="PairStart"
        region10="php.keyword" region11="PairEnd"
    /-->
    
    <keywords region="Symbol" ignorecase="yes">
        <symb name=";" region="SymbolStrong"/>
        <symb name="="/><symb name="+"/>
        <symb name="-"/><symb name="/"/><symb name="*"/>
        <symb name="&amp;"/><symb name="|"/><symb name="^"/>
        <symb name=","/><symb name="."/>
        <symb name="?" region="SymbolStrong"/>
        <symb name=":" region="SymbolStrong"/>
        <symb name="@" region="SymbolStrong"/>
        <symb name="!"/><symb name="~"/>
        <symb name="&lt;"/><symb name="&gt;"/>
        <symb name="%"/>
        <!-- word operators -->
        <word name="or"/>
        <word name="xor"/>
        <word name="and"/>
    </keywords>
    
    <!-- copy from c.hrc -->
    <keywords region="def:Error">
        <symb name="["/><symb name="]"/>
        <symb name="{"/><symb name="}"/>
        <symb name="("/><symb name=")"/>
        <symb name="*/"/>
    </keywords>
    
    <keywords region="KeywordStrong" ignorecase="yes">
        <word name="case-folded"/>
        <word name="case-folding"/>
    </keywords>
        
    <inherit scheme="base-keywords"/>      
    
    <regexp match="/([a-zA-Z][\w\d]+)(\:)\:?!/ix" region1="php.label" region2="SymbolStrong" priority="low"/>
    <regexp match="/(goto)\s+([a-zA-Z][\w\d]+)\s*/ix" region1="php.keyword" region2="php.label"/>
</scheme>
